package com.heima.controller;

import com.heima.common.result.Result;
import com.heima.pojo.dto.ChannelConfigDTO;
import com.heima.pojo.vo.ChannelVO;
import com.heima.service.ChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * \* User: chy
 * \* Date: 2025/8/24  20:18
 * \* Description:售货机货道详情
 * \
 */
@RestController
@RequestMapping("/api/vm-service/channel")
@Slf4j
public class ChannelController {

    @Autowired
    private ChannelService channelService;

    /**
     * 售货机货道详情
     *
     * @param innerCode
     * @return
     */
    @GetMapping("/channelList/{innerCode}")
    public List<ChannelVO> channelList(@PathVariable String innerCode) {

        return channelService.channelList(innerCode);
    }

    /**
     * 售货机货道配置
     *
     * @param channelConfigDTO
     * @return
     */
    @PutMapping("/channelConfig")
    public Result channelConfig(@RequestBody ChannelConfigDTO channelConfigDTO) {
        log.info("售货机货道配置：{}", channelConfigDTO);
        channelService.channelConfig(channelConfigDTO);
        return Result.success();
    }

}
